﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.IndexSettingsDefaultViewModel>" %>
<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<%@ Import Namespace="ChoViet.Lib.Paging" %>
<%@ Import Namespace="ChoViet.CMS.Controllers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý giá trị thiết lập mặc định
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if(ViewData["MessageInfo"]==null){ %>
	<form action="/SettingsDefault" method="post" name="adminForm">
		<table width="100%">
			<tr>
			    <td align="left">
			        Tìm nhanh <%= Html.TextBox("Keyword", Model.Keyword) %>
			        <%= Html.ActionImageJS("Tìm kiếm", "icon-32-search.png", "document.adminForm.submit();", false)%>
			    </td>
			</tr>
		</table>
		<table width="100%" class="adminlist">
		    <thead>
			<tr>
				<th width="10" align="right">
					STT
				</th>
				<th width="30">
				</th>
				<th width="30">
				</th>
				<th align ="center" width="150px">
					Tên Key
				</th>
				<th align ="center" width="300px">
					Giá trị
				</th>
				<th align ="center">
					Mô tả
				</th>
			</tr>
			</thead>
			<tbody>
		<% 
			int i = 0;
    		foreach (var item in Model.SettingsDefaults) {
				i++;
		%>
			<tr>
				<td align="right">
					<%= i.ToString() %>
				</td>
				<td align="center">
					<a href ="/SettingsDefault/Edit/?key=<%=item.Value%>"><img src="/Images/icon-24-edit.png" alt="Sửa" /></a>
				</td>
				 <td align="center">
					<a href="/SettingsDefault/Delete/?key=<%=item.Value%>"><img src="/Images/icon-24-delete.png" alt="Xóa" /></a>
				</td>
				<td>
				  <%=item.Value %>
				</td>
				<td>
				  <%=Html.Encode(item.Text)%>
				</td>
				<td>
				  <%=item.Description%>
				</td>
			</tr>
	    
		<% } %>
        </tbody>
		</table>
		
		<table width="100%">
            <tr>
                <td align="center">
             
                <div class="pager">
                <label>Hiển thị #</label>
                    <%
                        int[] pageSizeList = {1, 5, 10, 15, 20, 25, 50, 100};
                    %>
                    <%= Html.DropDownList("PageSize", new SelectList(pageSizeList, Model.SettingsDefaults.PageSize), new { onchange = "document.adminForm.submit();" })%>

                    <%= Html.Pager(Model.SettingsDefaults.PageSize, Model.SettingsDefaults.PageNumber, Model.SettingsDefaults.TotalItemCount)%>
                </div>
                </td>
            </tr>
        </table>
	</form>
 <% } %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
<td>
	<%= Html.Toolbar("Thêm mới", "/SettingsDefault/Create", "new") %>
 </td>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
Quản lý thiết lập mặc định
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>  
</asp:Content>
